<?php
namespace app\api\model;

class User extends BaseModel{
    public function address()
    {
        // 有外键关系的用belongto
        // 没有外键关系用hasone
        return $this->hasOne('UserAddress','user_id','id');
    }

    public static function getByOpenID($openid)
    {
        $user = self::where('openid','=',$openid)->find();
        return $user;
    }
    
}
